function errors=svm_LOOCV(data,kernel,C)

n=length(data.y);

errors=0;
for t=1:n
  train.X=data.X([1:t-1 t+1:n],:);
  train.y=data.y([1:t-1 t+1:n]);
  
  test.X=data.X(t,:);
  test.y=data.y(t);
  
  svm=svm_build(train,kernel,C);
  error=svm_classify(test,svm);
  
  errors=errors+error;
  
end
